<template>
	<view class="container">
		<view class="payListBox">
			<view class="payItem" v-for="item in payList" :style="{background:'url('+item.bg+')'+' '+'no-repeat'}">
				<view class="engText">{{item.eng}}</view>
				<view class="payInfo">
					<view class="payIcon">
						<!-- <image :src="item.img" mode=""></image> -->
					</view>
					<view class="payText">{{item.text}}</view>
				</view>
				<view class="toWallet" @click="goWallet(item.index)">进入钱包</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {

		},
		data() {
			return {
				payList: [
					// {index: 0,bg:'../../static/my/yibao.png',img:'',text:'易宝支付',eng:'YIBAOZHIFU'},
					//{index: 1,bg:'/h5/static/my/huifu.png',img:'',text:'汇付支付',eng:'HUIFUZHIFU'},
					// {index: 1,bg:'../../static/my/huifu.png',img:'',text:'汇付支付',eng:'HUIFUZHIFU'},
					{
						index: 2,
						bg: '../../static/my/tongtong1.png',
						img: '',
						text: '杉德支付',
						eng: 'SHANDEZHIFU'
					},
				],
				walletAccount: 0,
				integral: 0,
				userInfo: '',

			}
		},
		onLoad() {
			this.$http('api/user/userInfo').then(res => {
				this.userInfo = res;
			});
		},
		onShow() {
			


		},
		onHide() {

		},
		onReachBottom() {

		},
		onPullDownRefresh() {

		},
		methods: {
			goWallet(index) {
				console.log(this.userInfo)
				if (this.userInfo.is_fee == '0') {
					this.$http('api/Remittance/heepayWallet').then(res => {
						console.log(res)
						if (res.code == '1') {
							console.log('跳转前')
							window.location.href = res.redirect_url
							var url = res.redirect_url
							uni.openUrl({
							  url: url
							});
							console.log('跳转后')
						}
						if (res.code == '0') {
							this.toast(res.msg);
						}
					})
				} else {
					this.$http('api/Remittance/getSdPayurl').then(res => {
						console.log(res)
						console.log(res.code)
						console.log(res.data.redirect_url)
						if (res.code == '1') {
							console.log('跳转前')
							window.location.href = res.data.redirect_url
							var url = res.data.redirect_url
							uni.openUrl({
							  url: url
							});
							console.log('跳转后')
						}
						if (res.code == '0') {
							this.toast(res.msg);
						}
					})
				}
				// console.log(index)
				// this.$http('api/remittance/heepayWallet').then(res => {
				// 	console.log(res)
				// 	console.log(res.redirect_url)
				// 	if(res.code==1){
				// 		window.location.href = res.redirect_url
				// 		// var url = res.redirect_url;
				// 		// uni.navigateTo({
				// 		// 	url: './myWallet/webview?url=' + encodeURIComponent(JSON.stringify(url))
				// 		// })

				// 	}else{
				// 		uni.showToast({
				// 			title: res.result_msg,
				// 			icon:'none'
				// 		})
				// 	}
				// })
			}
		}
	}
</script>

<style lang="less" scoped>
	.container {
		.payListBox {
			width: 90%;
			margin: 0 auto;

			.payItem {
				width: 100%;
				height: 350rpx;
				background-size: contain !important;
				position: relative;
				margin-top: 30rpx;

				.engText {
					position: absolute;
					right: 20rpx;
					color: rgba(255, 255, 255, .6);
					top: 20rpx;
					font-family: fantasy;
					letter-spacing: 2rpx;
				}

				.payInfo {
					position: absolute;
					top: 40rpx;
					left: 20rpx;
					display: flex;
					align-items: center;

					.payIcon {
						width: 96rpx;
						height: 96rpx;
						border-radius: 50%;
						background-color: #fff;
					}

					.payText {
						color: #fff;
						margin-left: 20rpx;
						letter-spacing: 2rpx;
					}
				}

				.toWallet {
					width: 200rpx;
					height: 60rpx;
					line-height: 60rpx;
					border-radius: 30rpx;
					position: absolute;
					right: 40rpx;
					bottom: 40rpx;
					text-align: center;
					background-color: #fff;
					color: #29406A;
					font-size: 26rpx;
					font-weight: bold;
				}
			}
		}
	}
</style>
